from __future__ import absolute_import, unicode_literals
from finance_c2c import celery_app as app
from apps.coffee.models import CouponInfo


@app.task()
def task_new_user_coupon(**kwargs):
    user_id = kwargs.get("user_id")
    channel_key = kwargs.get("channel_key")
    result = CouponInfo.objects.verify_coupon(user_id, 2, 1300)
    if result:
        pass
    else:
        CouponInfo.objects.create_coupon(1, user_id, channel=channel_key, quota=1300)
